<template>
  <nav class="bg-white shadow-sm sticky top-0 z-50">
    <!-- 顶部导航条 -->
    <div class="container mx-auto px-2">
      <!-- 网站logo和主导航 -->
      <div class="flex items-center justify-between py-3">
        <!-- Logo -->
        <div class="flex items-center space-x-8">
          <div class="flex items-center">
            <!-- 黄色可爱的卡通小球 -->
            <div class="w-10 h-10 rounded-full bg-yellow-400 relative">
              <div class="absolute inset-0 rounded-full bg-yellow-300 opacity-50 animate-pulse"></div>
              <div class="absolute inset-2 rounded-full bg-yellow-500"></div>
              <div class="absolute inset-0 flex items-center justify-center">
                <i class="fa fa-smile-o text-white text-xl"></i>
              </div>
            </div>
            <span class="text-xl font-bold text-yellow-600 ml-2">布钛</span>
          </div>
          
          <!-- 桌面导航 -->
          <div class="hidden md:flex space-x-6">
            <a href="#" class="nav-item nav-item-active">首页</a>
            <a href="#" class="nav-item">全部课程</a>
            <a href="#" class="nav-item">合作院校</a>
            <a href="#" class="nav-item">同等学力</a>
            <a href="#" class="nav-item">雨课堂</a>
            <a href="#" class="nav-item">Online MBA</a>
            <a href="#" class="nav-item">企业服务</a>
            <a href="#" class="nav-item">更多 ▾</a>
          </div>
        </div>
        
        <!-- 搜索框和登录/注册按钮 -->
        <div class="hidden md:flex items-center space-x-4">
          <!-- 搜索框 -->
          <div class="relative">
            <input 
              type="text" 
              placeholder="心理学" 
              class="w-48 py-1.5 px-3 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-yellow-500 focus:border-transparent"
            >
            <button class="absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-yellow-600">
              <i class="fa fa-search"></i>
            </button>
          </div>
          
          <!-- 语言选择 -->
          <button class="text-gray-600 hover:text-yellow-600 px-2">
            <i class="fa fa-globe"></i> 中文 ▾
          </button>
          
          <!-- 登录按钮 -->
          <a href="#" class="text-gray-600 hover:text-yellow-600 px-2">登录</a>
          
          <!-- 注册按钮 -->
          <button class="bg-yellow-500 hover:bg-yellow-600 text-white px-4 py-1.5 rounded-md transition-colors">
            注册
          </button>
        </div>
        
        <!-- 移动端菜单按钮 -->
        <button class="md:hidden p-2" @click="toggleMenu">
          <i class="fa fa-bars text-xl text-gray-600"></i>
        </button>
      </div>
      
      <!-- 移动端菜单 -->
      <div v-if="mobileMenuOpen" class="md:hidden bg-white py-2 border-t">
        <a href="#" class="block px-4 py-2 hover:bg-yellow-50">首页</a>
        <a href="#" class="block px-4 py-2 hover:bg-yellow-50">全部课程</a>
        <a href="#" class="block px-4 py-2 hover:bg-yellow-50">合作院校</a>
        <a href="#" class="block px-4 py-2 hover:bg-yellow-50">同等学力</a>
        <a href="#" class="block px-4 py-2 hover:bg-yellow-50">雨课堂</a>
        <a href="#" class="block px-4 py-2 hover:bg-yellow-50">Online MBA</a>
        <a href="#" class="block px-4 py-2 hover:bg-yellow-50">企业服务</a>
        <a href="#" class="block px-4 py-2 hover:bg-yellow-50">更多</a>
        <!-- 移动端搜索框 -->
        <div class="px-4 py-2">
          <div class="relative">
            <input 
              type="text" 
              placeholder="搜索课程..." 
              class="w-full py-1.5 px-3 border border-gray-300 rounded-md"
            >
            <button class="absolute right-3 top-1/2 transform -translate-y-1/2 text-gray-400">
              <i class="fa fa-search"></i>
            </button>
          </div>
        </div>
        <!-- 移动端登录/注册 -->
        <div class="flex justify-between px-4 py-2">
          <a href="#" class="text-gray-600">登录</a>
          <button class="bg-yellow-500 text-white px-4 py-1 rounded-md">注册</button>
        </div>
      </div>
    </div>
  </nav>
</template>

<script>
export default {
  name: 'BuwaitiNavbar',
  data() {
    return {
      mobileMenuOpen: false
    }
  },
  methods: {
    toggleMenu() {
      this.mobileMenuOpen = !this.mobileMenuOpen
    }
  }
}
</script>

<style scoped>
.nav-item {
  color: #666;
  text-decoration: none;
  padding: 8px 4px;
  border-radius: 4px;
  transition: all 0.3s ease;
  font-size: 14px;
  position: relative;
}

.nav-item:hover {
  color: #eab308;
}

.nav-item-active {
  color: #eab308;
  font-weight: 500;
  position: relative;
}

.nav-item-active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background-color: #eab308;
}
</style>